home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / intuition / newobjecta.c < prev    next >
C/C++ Source or Header  |  1996-09-12  |  3KB  |  103 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: newobjecta.c,v 1.1 1996/08/28 17:55:35 digulla Exp $
  4.     $Log: newobjecta.c,v $
  5.     Revision 1.1  1996/08/28 17:55:35  digulla
  6.     Proportional gadgets
  7.     BOOPSI
  8.  
  9.  
  10.     Desc:
  11.     Lang: english
  12. */
  13. #include <intuition/classes.h>
  14. #include <clib/exec_protos.h>
  15. #include <clib/alib_protos.h>
  16. #include "intuition_intern.h"
  17.  
  18. /*****************************************************************************
  19.  
  20.     NAME */
  21.     #include <intuition/classusr.h>
  22.     #include <clib/intuition_protos.h>
  23.  
  24.     __AROS_LH3(APTR, NewObjectA,
  25.  
  26. /*  SYNOPSIS */
  27.     __AROS_LHA(struct IClass  *, classPtr, A0),
  28.     __AROS_LHA(UBYTE          *, classID, A1),
  29.     __AROS_LHA(struct TagItem *, tagList, A2),
  30.  
  31. /*  LOCATION */
  32.     struct IntuitionBase *, IntuitionBase, 106, Intuition)
  33.  
  34. /*  FUNCTION
  35.     Use this function to create BOOPSI objects (BOOPSI stands for
  36.     "Basic Object Oriented Programming System for Intuition).
  37.  
  38.     You may specify a class either by it's name (if it's a public class)
  39.     or by a pointer to its definition (if it's a private class). If
  40.     classPtr is NULL, classID is used.
  41.  
  42.     INPUTS
  43.     classPtr - Pointer to a private class (or a public class if you
  44.         happen to have a pointer to it)
  45.     classID - Name of a public class
  46.     tagList - Initial attributes. Read the documentation of the class
  47.         carefully to find out which attributes must be specified
  48.         here and which can.
  49.  
  50.     RESULT
  51.     A BOOPSI object which can be manipulated with general functions and
  52.     which must be disposed with DisposeObject() later.
  53.  
  54.     NOTES
  55.     This functions send OM_NEW to the dispatcher of the class.
  56.  
  57.     EXAMPLE
  58.  
  59.     BUGS
  60.  
  61.     SEE ALSO
  62.     DisposeObject(), SetAttrs(), GetAttr(), MakeClass(),
  63.     "Basic Object-Oriented Programming System for Intuition" and
  64.     "boopsi Class Reference" Dokument.
  65.  
  66.     INTERNALS
  67.  
  68.     HISTORY
  69.     29-10-95    digulla automatically created from
  70.                 intuition_lib.fd and clib/intuition_protos.h
  71.  
  72. *****************************************************************************/
  73. {
  74.     __AROS_FUNC_INIT
  75.     __AROS_BASE_EXT_DECL(struct IntuitionBase *,IntuitionBase)
  76.     Object * object;
  77.     struct _Object carrier;
  78.  
  79.     /* No classPtr ? */
  80.     if (!classPtr)
  81.     {
  82.     /* Search for the class */
  83.     if (!(classPtr = (Class *)FindName (PublicClassList, classID)) )
  84.         return (NULL); /* Nothing found */
  85.     }
  86.  
  87.     /* Put the classPtr in our dummy object */
  88.     carrier.o_Class = classPtr;
  89.  
  90.     /* Try to create a new object */
  91.     if ((object = (Object *) DoMethod (BASEOBJECT(&carrier), OM_NEW,
  92.         tagList, NULL)))
  93.     {
  94.     OCLASS(object) = classPtr;
  95.  
  96.     /* One more object */
  97.     classPtr->cl_ObjectCount ++;
  98.     }
  99.  
  100.     return (object);
  101.     __AROS_FUNC_EXIT
  102. } /* NewObjectA */
  103.